.binary-search-playground {
  min-height: 100vh;
  background: #f8f9fa;
  padding: 20px 0;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
}

.binary-search-container {
  display: flex;
  height: 100vh;
  padding: 20px;
  position: relative;
}

/* 拖拽分隔条 */
.resize-handle {
  width: 10px;
  background: transparent;
  cursor: col-resize;
  position: relative;
  flex-shrink: 0;
}

.resize-handle:hover::after,
.resize-handle:active::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #007bff;
  transform: translateX(-50%);
}

/* 左侧控制面板 */
.left-panel {
  flex-shrink: 0;
  min-width: 300px;
  max-width: 1000px;
  height: 100%;
  overflow: hidden;
}

/* 右侧动画面板 */
.animation-panel {
  flex: 1;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.animation-panel h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
}

/* 数据可视化容器 */
.data-visualization {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px dashed #dee2e6;
  min-width: 100%;
  overflow-x: auto;
  position: relative;
}

/* 空状态 */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  font-size: 16px;
}

/* 条形图容器 */
.bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  height: 250px;
  min-width: 100%;
}

/* 数据条形图 */
.binary-data-bar {
  min-width: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  color: white;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  margin: 0 2px;
}

.binary-data-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.binary-data-bar .value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.binary-data-bar .index {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  color: #666;
  font-size: 12px;
  font-weight: normal;
  background: white;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #ddd;
}

/* 二分查找特有的样式 */
.binary-data-bar.left-bound {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.binary-data-bar.right-bound {
  background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(253, 126, 20, 0.4);
}

.binary-data-bar.mid-point {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(255, 193, 7, 0.5);
  z-index: 10;
  animation: midPointPulse 1s ease-in-out infinite alternate;
}

.binary-data-bar.target-found {
  background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
  transform: scale(1.2);
  box-shadow: 0 8px 20px rgba(220, 53, 69, 0.6);
  z-index: 15;
  animation: targetFoundGlow 1.5s ease-in-out infinite alternate;
}

/* 动画效果 */
@keyframes midPointPulse {
  0% {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(255, 193, 7, 0.5);
  }
  100% {
    transform: scale(1.2);
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.7);
  }
}

@keyframes targetFoundGlow {
  0% {
    transform: scale(1.2);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.6);
  }
  100% {
    transform: scale(1.25);
    box-shadow: 0 10px 25px rgba(220, 53, 69, 0.8);
  }
}

/* 搜索范围指示器 */
.search-indicators {
  position: absolute;
  top: 10px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
}

.search-indicator {
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.search-indicator.left {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

.search-indicator.right {
  background: rgba(253, 126, 20, 0.1);
  color: #fd7e14;
}

.search-indicator.mid {
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
}

.search-indicator.found {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .binary-search-container {
    flex-direction: column;
    height: auto;
    padding: 10px;
  }
  
  .left-panel {
    width: 100% !important;
    max-width: none;
    margin-bottom: 20px;
  }
  
  .resize-handle {
    display: none;
  }
  
  .animation-panel {
    min-height: 400px;
  }
  
  .data-visualization {
    height: 250px;
    padding: 15px;
  }
  
  .binary-data-bar {
    min-width: 40px;
    font-size: 12px;
  }
  
  .binary-data-bar .value {
    font-size: 12px;
  }
  
  .binary-data-bar .index {
    font-size: 10px;
    bottom: -20px;
  }
}

@media (max-width: 480px) {
  .binary-search-playground {
    padding: 10px 0;
  }
  
  .binary-search-container {
    padding: 5px;
  }
  
  .animation-panel {
    padding: 15px;
  }
  
  .animation-panel h2 {
    font-size: 20px;
    margin-bottom: 15px;
  }
  
  .data-visualization {
    height: 200px;
    padding: 10px;
    gap: 4px;
  }
  
  .binary-data-bar {
    min-width: 35px;
    margin: 0 1px;
  }
  
  .binary-data-bar .value {
    font-size: 11px;
  }
  
  .binary-data-bar .index {
    font-size: 9px;
    bottom: -18px;
    padding: 1px 4px;
  }
}
